This README file is for replication of the results in:
"The Dynamic Impacts of Pricing Groundwater" by Ellen Bruno, Katrina Jessoe, and Michael Hanemann for publication in JAERE 

We describe the research design and empirical specifications in the manuscript with the intent that it provides sufficient information for replication. 
This file includes instructions for requesting the confidential data, lists and explains the processing files that can be used for replication, provides 
source information for secondary public data, and provides any additional instructions needed to execute the code.  

DATA
Primary Confidential Data:
The primary dataset used for this study was obtained through a non-disclosure agreement with the Pajaro Valley Water Management Agency (PV Water).
These data include well-level groundwater extraction, well-level water quality measures, recycled water deliveries, geospatial groundwater depth 
contours, and geospatial field-level land use surveys as described in the paper and summarized in Table 1. 
To request access, email general manager Brian Lockwood at Lockwood@pvwater.org. 

Secondary Public Data:
1. Land ownership data (tax parcels) collected from County Assessor Offices 
Geospatial file for Monterrey County available for download here: 
https://montereycountyopendata-12017-01-13t232948815z-montereyco.opendata.arcgis.com/datasets/parcels/explore
Geospatial file for Santa Cruz County available for download here:
https://www.santacruzcountyca.gov/Departments/GeographicInformationSystems(GIS).aspx
Files were merged and clipped to PV Water district boundaries using ArcGIS. See "Data\Pajaro_Parcel.zip."

2. PG&E electricity prices for agriculture available for download at: www.pge.com/tariffs/electric.shtml
The two most relevant agricultural electricity rates are: 1B – Large agriculture, flat electricity rate; and, 5B – Large agriculture, most common 
time-of-use rate. The files listed on this site are the definitive resource for PG&E’s agricultural electric tariffs from 2008 onwards.  These 
files are created by summarizing the data in advice letters between PG&E and the California Public Utilities Commission (CPUC).
Scroll down to “Small Agricultural” and “Large Agricultural” sections. Click on the relevant tariff link to download the xls file
See "Data\electricity_rates_20210601.dta."
3. Water prices manually collected from agency documents available at: https://www.pvwater.org/resources-references.
Summarized in "Data\price_data_20210527.dta."

4. Land use datasets 
CSDA Cropland Data Layer: https://www.nass.usda.gov/Research_and_Science/Cropland/SARS1a.php
See "Data\Pajaro_CDL.zip"
USGS Land Change Monitoring, Assessment, and Projection: https://www.usgs.gov/special-topics/lcmap
See "Data\Pajaro_LCMAP.zip"

SCRIPTS
Here is a list of the scripts used for reproducing figures and tables in the main text and appendix.
Descriptions of the contents of each of the following replication code files are included at the top of each file.
Scripts are commented with step-by-step instructions for replication including directions on where code must 
be altered to enable replication.

QualityCL_prePY.do - prepares raw groundwater quality data for processing in ArcPy
QualityCL.py - performs spatial manipulation in ArcGIS
QualityCL_preprocessing.do - takes ArcGIS output and processes it to be merged in with other variables

Depth.py - inputs raw groundwater depth contours and performs spatial manipulation in ArcGIS
Depth_preprocessing.do - takes ArcGIS output and processes it to be merged in with other variables

Extraction_preprocessing.do - takes raw groundwater production data and processes it to be merged in with other variables
Well_clean.do - merges and cleans all water variables at well level
Parcel_clean.do - merges and cleans all water variables at parcel level
assign-grid.py - creates grid for spatial clustering of standard errors at different levels
Parcel_Figs.do - produces figures and summary statistics 
Event_study.do - event study regressions and figures
ES_elasticity.do - calculations for elasticities over time
Table4_elasticity_calc.xls - calculations for elasticities over time
Extraction_diffindiff.do - parcel-level difference-in-difference regressions and other robustness checks
Extraction_diffindiff_well.do - well-level difference-in-difference regressions

basic_land.py - assigns land use types to tax parcels and cleans land use data
parcel_IDs.py - creates a dictionary of parcel IDs
Land_clean.do - merges and cleans all land variables at parcel level
land_eventstudy.do - land use event study regressions and figures

For LCMAP Cross Tabulation, see files in "LCMAPvsPVWater" folder:
lcmap_vs_pvwater.py - creates disaggregated cross tab figures
lcmap_vs_pvwater_agg.py - creates aggregated cross tab figures
data_dir.py -- lists files and directories to store files created by lcmap_vs_pvwater.py and lcmap_vs_pvwater_agg.py scripts
utils_agg.py -- contains functions for heatmap crosstabs used in lcmap_vs_pvwater_agg.py
utils.py -- contains functions for heatmap crosstabs used in lcmap_vs_pvwater.py
lcmap.py -- defines and renames lcmap categories for land cover used in lcmap_vs_pvwater.py
lcmap_agg.py -- defines and renames lcmap categories for land cover used in lcmap_vs_pvwater_agg.py
pvwater.py -- defines and renames pvwater categories for land cover used in lcmap_vs_pvwater.py
pvwater_agg.py -- defines and renames pvwater categories for land cover used in lcmap_vs_pvwater_agg.py

For CDL Cross Tabulation, see files in "CDLvsPVWater" folder:
cdl_vs_pvwater.py - generates cross tabulation figure
cdl.py, pvwater.py, utils.py, data_dir.py - define useful functions for other scripts to use

SOFTWARE REQUIREMENTS
Stata 15.1 Run time for all Stata scripts <10min
ArcMAP 10.8.1 Run time for all ArcPy commands <2 hrs
Python Run time for all Python scripts <10 hrs

Below lists all figures and tables that appear in the manuscript and online appendix with a description 
of where to find the output used to generate each. 

LIST OF FIGURES AND TABLES

Main Text

[Fig 1:  (not empirical)]
[Fig 2:  (not empirical)]
Fig 3: Volumetric Groundwater Prices by Zone (Parcel_Figs.do)
Fig 4: Groundwater Extraction Event Study (Event_study.do)
Fig 5: Dyanmic Response of Pricing Regime on Total Agricultural Land (Land_eventstudy.do)
Fig 6: Dyanmic Response of Pricing Regime on Annual Crops (Land_eventstudy.do)
Table 1: Descriptive Statistics (Parcel_Figs.do)
Table 2: Impact of Regional Pricing on Groundwater Extraction (Extraction_diffindiff.do)

Appendix

Fig 7: PG&E Electricity Prices (Parcel_Figs.do)
Fig 8: Average Extraction by Zone (Parcel_Figs.do)
Fig 9: Robustness of Annual Groundwater Use Event Study to Exclusion of Q3 (Event_study.do)
Fig 10: Recycled Water Deliveries by Zone (Parcel_Figs.do)
Fig 11: Average Gross Water Use (Parcel_Figs.do)
Figure 12: Parcel Count by Year (Parcel_Figs.do)
Figure 13: Cross Tab USDA to PV Water (cdl_vs_pvwater.py)
[Figure 14:  (not empirical)]
Figure 15: Aggregated Cross Tab of PV Water to LCMAP (lcmap_vs_pvwater_agg_flip.py)
Figure 16: Aggregated Cross Tab of LCMAP to PV Water (lcmap_vs_pvwater_agg.py)
Figure 17: Disaggregated Cross Tab of LCMAP to PV Water (lcmap_vs_pvwater_flip.py)
Table 3: Test for Pre-treatment Regional Trends in Extraction (Extraction_diffindiff.do)
Table 4: Imputed Elasticities over Time (ES_elasticity.do + Table4_elasticity_calc.xls)
Table 5: Wald Test Pairwise Comparisons (Event_study.do)
Table 6: Impact of Regional Pricing on Summer and Annual Extraction, inclusive of 2016 (Event_study.do)
Table 7: Impact of Regional Pricing on Annual Per-Acre Extraction (Event_study.do)
Table 8: Impact of Regional Pricing on Quarterly Groundwater Extraction, unbalanced panel (Extraction_diffindiff.do)
Table 9: Impact of Regional Pricing on Annual Groundwater Extraction, well-level (Extraction_diffindiff_well.do)
Table 10: Impact of Regional Pricing on Annual Groundwater Extraction, standard errors clustered at various levels 
of spatial aggregation) (Extraction_diffindiff.do)




